import request from '../utils/request'

export function getTableInfo (index, pageSize, token) {
  return request.get('/system/sceneType/sceneTypeList', {
    params: {
      index, pageSize, token
    }
  })
}

export function deleteSceneType (id) {
  return request.post('system/sceneType/removeSceneType', {}, {
    params: {
      id
    }
  })
}

// 获取传感器类型
export function getSensorType (index, pageSize) {
  return request.get('/system/deviceType/deviceTypeList', {
    params: {
      index,
      pageSize
    }
  })
}
export function getSensorSlectList () {
  return request.get('/system/sceneType/deviceTypeList')
}

// 新增场景类型
export function addSceneType (val) {
  return request.post('system/sceneType/addSceneType', val)
}

// 根据id获取场景信息然后编辑
export function getWriteSensor (id) {
  return request.get(`/system/sceneType/getSceneType?id=${id}`)
}

// 删除场景类型下设备类型
export function deleteDeviceDetail (deviceTypeId, sceneTypeId) {
  return request.post('system/sceneType/removeDeviceType', {}, {
    params: {
      deviceTypeId,
      sceneTypeId
    }
  })
}

// 提交编辑好的场景信息
export function updateSceneDetail (id, val) {
  return request.post(`system/sceneType/updateSceneType?id=${id}`, val)
}
